import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ui/api/router.dart';
import 'package:ui/view/setting/logic.dart';

import 'logic.dart';

class HomePage extends StatelessWidget {
  HomePage({super.key});

  final logic = Get.put(HomeLogic());
  final settingLogic = Get.put(SettingLogic());
  final state = Get.find<HomeLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: IconButton(
        // color: Colors.black,
        onPressed: () {
          Get.toNamed(Routes.addArchives);
        },
        icon: const Icon(Icons.add_sharp, size: 35),
        tooltip: "添加单子",
      ),
      appBar: AppBar(
        title: const Text("控制页面"),
        backgroundColor: Colors.lightBlueAccent,
        centerTitle: true,
        leading: const Text(
          "beta",
          style: TextStyle(color: Colors.red),
        ),
      ),
      body: Obx(() {
        return Column(
          children: [
            Container(
              // alignment: Alignment.center,
              margin: const EdgeInsets.all(5),
              height: 120,
              child: logic.topPricesShow,
            ),
            Expanded(child: ListView(children: logic.listtile)),
          ],
        );
      }),
    );
  }
}
